/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package typinggame;

import java.awt.*;
import java.awt.*;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.*;
import java.util.*;
/**
 *
 * @author suhui
 */
public class TypingGame extends Frame{

    private gameplayview play;
    private GameInfo info;


    public TypingGame() {

        super();

        setLayout(new BorderLayout());
        setFont(new Font("Dialog", Font.PLAIN, 11));
        setBackground(Color.black);
        setSize(1000,540);
        //setResizable(false);
        setVisible(true);

        /*Canvas canvas = new Canvas();
        canvas.setSize(1000, 500);
        canvas.setBackground(Color.white);

        Container c = getContentPane();
        FlowLayout manager = new FlowLayout();
        c.setLayout(manager);
        c.add(canvas);*/
        

        setinfo();
        start();

        //pack();
    }
    public void setinfo()
    {
        info = new GameInfo("Yoda",10,1200);
    }
    public void start()
    {
        

        play = new gameplayview();
        play.setgameinfo(info);
        add(play);
        play.requestFocus();
        play.start();
    }
    @Override
    public boolean keyDown(Event event, int key) {

            // All the keypress events this windows receive are forwarded to the
            // falling keys control

            play.deliverEvent(event);
            return true;
    }

    public boolean handleEvent(Event event) {
		switch(event.id) {
			case Event.WINDOW_DESTROY:

				// Closing the window exits the program


					System.exit(0);
				break;
                default:
				break;
		}

		return super.handleEvent(event);
	}


    public static void main(String[] args) throws IOException {

		TypingGame game = new TypingGame();


		//game.show();

                //System.in.read();

                
	}
}
